home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MIDICraft's MIDINET CD-ROM
/
MIDICraft's MIDINET CD-ROM.iso
/
DOSUTILS
/
MIDINOTE.DOC
< prev
next >
Wrap
Text File
|
1997-04-21
|
8KB
|
210 lines
******************************
MIDINOTE v2.0
midi binaries to sorted notes
by Guenter Nagler
1997
(gnagler@ihm.tu-graz.ac.at)
******************************
[1] BACKGROUND
Midi file format is not easy to read because there are different formats,
many commands, variable length data, parallel tracks and separate note on
and note off commands that make it difficult to find note matches.
For programs that only want to analyze notes I wrote this converter
that exports note information into a simple text table where notes are
already sorted by time and contain most important parameters:
- start and length in midi units and milliseconds
- track (1-track count)
- channel (1-16)
- note value (0-127, where C4 middle C is 60 and A4 is 440Hz)
- velocity (0-127)
It shows also some other midi events that might be necessary for note processing:
* header information (units/beat, track count, version)
* tempo information (beats/min)
* tact information (bar beats/tact)
This simplier form of midi notes can be used in a variety of applications:
score drawing, music and painting, lerning process of automatic composing,
comparing music pieces, music pattern matching.
[2] FILES DESCRIPTION
MIDINOTE.EXE.........converter program
MIDINOTE.DOC.........this file, showing usage of MIDINOTE.EXE
MIDIIO.HPP..........header file for a c++ midi parser
MIDIIO.CPP..........source code for a c++ midi parser
MIDINOTE.CPP.........c++ source code for midi to note listing
MIDINOTE.MAK.........make file for project
MIDINOTE.CFG.........compiler options for make
MIDINOTE.PRJ.........project for borland c++ compilers
only MIDINOTE.EXE is required to run program
[3] COPYRIGHT
MIDINOTE (c) 1997 was created by Guenter Nagler.
MIDINOTE is free and may be used as you wish with this one exception:
You may NOT charge any fee or derive any profit for distribution
of MIDINOTE. Thus, you may NOT sell or bundle MIDINOTE with any
product in a retail environment (shareware disk distribution, CD-ROM,
etc.) without permission of the author.
You may give MIDINOTE to your friends, upload it to a BBS, or ftp it to
another internet site, as long as you don't charge anything for it.
[4] DISCLAIMER
MIDINOTE was designed to handle 100% compatible standard midi files.
So I give no guarantees of the results, especially with non 100%
compatible midi files.
If you find a midi file that you think to be 100% compatible midi
that is not correctly converted, please send a sample file to
gnagler@ihm.tu-graz.ac.at .
Use MIDINOTE at your own risk. Anything you do with MIDINOTE is your
responsibility, and not the author's. Any damage caused to any person,
computer, software, hardware, company, or business by running MIDINOTE
is your responsibility, and the author will not be liable.
If you don't understand these terms, or are not sure of something, or
are afraid something bad might come of using MIDINOTE, don't use it!
You are here forewarned.
[5] INSTALLATION
[MSDOS]
Simply copy MIDINOTE.EXE in a directory that is in your path.
When you start the program without arguments
C:\> MIDINOTE
you should get the usage text (see next section)
[UNIX]
compile sources with your C++ compiler (e.g. GNU Compiler g++):
g++ -o midinote midinote.cpp midiio.cpp
and run program
$ midinote
[6] USAGE
usage: midinote [-noheader] [-values] input.mid [output.txt]
-noheader don't print header that explains the columns
-values print cryptical values for easier import into programs
input.mid get notes sorted by start time from this midi file
output.txt write output into a text file (default: standard output)
The parts in brackets [...] are optional.
Without specifying output.txt the text output is normally written to screen
but can be relinked to a file (> filename.txt) or a printer (> prn).
See your MS-DOS/UNIX manual for usage of > and >> operators.
If midi file contains errors or not enough memory is available
the output will be aborted. The memory requirements depend on the number of
notes started while the note with longest duration is played. In this case
the note length can only be computed when this note is turned off and in meantime
all notes are waiting in memory for printing.
The hidden option -version shows the program version.
[7] A sample of resulting text output
command> midinote sample.mid
Command Unit At Track Channel Params
Header 0 0ms T0 C0 Ver1 480units 17tracks
Tempo 0 0ms T0 C0 155.09bpm
Note 3840 3094ms T7 C7 436units 352ms b4 Vel103
Note 3840 3094ms T10 C10 447units 361ms c#3 Vel97
Note 3840 3094ms T7 C7 450units 363ms g#4 Vel120
Note 3840 3094ms T7 C7 462units 373ms e4 Vel107
Note 3840 3094ms T10 C10 509units 411ms c2 Vel61
Note 3840 3094ms T2 C2 940units 758ms e2 Vel118
Note 4297 3463ms T7 C7 250units 201ms b4 Vel107
... and more such lines
A more simplier form for programs can be produced by:
command> midinote -noheader -values sample.mid
H 0 0 0 0 1 480 17
T 0 0 0 0 155.09
N 3840 3094 7 7 436 352 71 103
N 3840 3094 10 10 447 361 49 97
N 3840 3094 7 7 450 363 68 120
N 3840 3094 7 7 462 373 64 107
N 3840 3094 10 10 509 411 36 61
N 3840 3094 2 2 940 758 40 118
N 4297 3463 7 7 250 201 71 107
... and more such lines
The columns have same meaning as above (see header). The first 4 values and the
command name character are always available and are separated by a tab character (#9, '\t').
The params are different for each command.
Unit:
This value is start of event in midi time units
(the song starts at unit 0).
At:
This value is start of note in milliseconds (the song starts at
millisecond 0). Tempo changes inside midi file are already
included in time computation.
Track:
Track number starts to count at 1 (Only Header is assumed Track 0).
Each note is assigned to a track and a channel. Tracks are logical
parts of a song. All tracks play parallel. Multichannel tracks have
only one track. Single channel tracks should only contain notes
assigned to a certain channel.
Channel:
Channel number is between 1 and 16 (Some events don't refer a channel, in this
case channel is 0). Most events are assigned to a channel (e.g. notes).
Channel 10 is usually reserved for drums (General Midi specification).
Drum notes representate certain drum instruments (see General Midi
instrument list).
A "Header" (H) command has following parameters:
Version: 0=One track containing all events
1=More tracks, each track only contains events of max. one channel
2=Each track contains a song
Resolution: number of units per beat (usually 96, 120, 192,384, 480)
Trackcount: number of tracks
A "Tempo" (T) command has following parameter:
BeatsPerMinute: number of beats per minute (usually 40bpm-240bpm,
initially 120bpm before first tempo command)
A "Note" (N) command has following parameters:
Length: the note is played for certain number of units
Time: the note is played for about this number of milliseconds.
Note: A note value lies between 0 and 127. 12 notes in sequence build an octave:
C, C#, D,D#,E,F,F#,G,G#,A,A#,B
Octaves are counted from -1 till 10.
Octaves are computed by formula: (notevalue / 12)-1
Therefore note value 60 is middle C (C4). A4 is middle A with frequency 440Hz.
Velocity: A note velocity (1-127) measures how hard the keyboard key corresponding
to this note was pushed. This parameter influences volume, effects and
other note parameters. Notes with velocity 127 are usually played very
loud and with full effects assigned to the sound of this channel.
[8] SUGGESTIONS / COMMENTS / BUG REPORTS / QUESTIONS
WWW: http://hgiicm.tu-graz.ac.at/Cpub
contains all my dos/unix midi programs
EMAIL: gnagler@ihm.tu-graz.ac.at
[9] CHANGES
v1.0 to v2.0:
* Warning: format of output has totally changed
* Now the program also can output other events than notes (currently
header, tempo, tact measures)